package com.easytouch.core.model;

import com.easytouch.core.utils.Log;

import org.json.JSONException;
import org.json.JSONObject;

public class GoodsDownloadModel {

    public String prodataUrl = "";
    public String prodataMd5 = "";
    public String islock = "";
    public String unit = "";
    public String price = "";
    public String name = "";
    public String productDate = "";
    public String days = "";
    public String type = "";
    public String barcode = "";
    public String spec = "";
    public int failID = -1;
    public String nameURLEncoder = "";
    public String kind = "";

    private static Log mloger = new Log("GoodsDownloadModel.txt");

    public GoodsDownloadModel() {
    }

    public static GoodsDownloadModel fromJson(final JSONObject object) {
        GoodsDownloadModel model = new GoodsDownloadModel();
        if (object != null) {
            try {
                model.prodataUrl = object.getString("prodataUrl");
                model.price = object.getString("price");
                model.name = object.getString("name");
                model.barcode = object.getString("barcode");
                model.prodataMd5 = object.getString("prodataMd5");
                model.nameURLEncoder = object.getString("nameURLEncoder");

                model.type = object.getString("type");
                model.islock = object.getString("islock");
                model.days = object.getString("days");
                model.unit = object.getString("unit");
                model.spec = object.getString("spec");

                model.kind = object.getString("kind");

                model.productDate = object.getString("productDate");

            } catch (JSONException e) {
                return model;
            }
        }
        return model;
    }

}
